package com.maimang.platform.common.entity;

import com.maimang.platform.base.BaseEntity;
import com.maimang.platform.enums.OnlineStatus;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 当前在线会话 sys_user_online
 *
 * @author Rocky
 */
public class SysUserOnline extends BaseEntity {
	private static final long serialVersionUID = 1L;

	/**
	 * 用户会话id
	 */
	private String sessionId;

	/**
	 * 部门名称
	 */
	private String deptName;

	/**
	 * 登录名称
	 */
	private String loginName;
	/**
	 * 用户名称
	 */
	private String userName;
	/**
	 * 登录IP地址
	 */
	private String ipaddr;
	/**
	 * 登录地址
	 */
	private String loginLocation;
	/**
	 * 浏览器类型
	 */
	private String browser;
	/**
	 * 操作系统
	 */
	private String os;
	/**
	 * session创建时间
	 */
	private Date startTimestamp;
	/**
	 * session最后访问时间
	 */
	private Date lastAccessTime;
	/**
	 * 超时时间，单位为分钟
	 */
	private Long expireTime;
	/**
	 * 在线状态
	 */
	private OnlineStatus status = OnlineStatus.on_line;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getIpaddr() {
		return ipaddr;
	}

	public void setIpaddr(String ipaddr) {
		this.ipaddr = ipaddr;
	}

	public String getLoginLocation() {
		return loginLocation;
	}

	public void setLoginLocation(String loginLocation) {
		this.loginLocation = loginLocation;
	}

	public String getBrowser() {
		return browser;
	}

	public void setBrowser(String browser) {
		this.browser = browser;
	}

	public String getOs() {
		return os;
	}

	public void setOs(String os) {
		this.os = os;
	}

	public Date getStartTimestamp() {
		return startTimestamp;
	}

	public void setStartTimestamp(Date startTimestamp) {
		this.startTimestamp = startTimestamp;
	}

	public Date getLastAccessTime() {
		return lastAccessTime;
	}

	public void setLastAccessTime(Date lastAccessTime) {
		this.lastAccessTime = lastAccessTime;
	}

	public Long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(Long expireTime) {
		this.expireTime = expireTime;
	}

	public OnlineStatus getStatus() {
		return status;
	}

	public void setStatus(OnlineStatus status) {
		this.status = status;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
				.append("sessionId", getSessionId())
				.append("loginName", getLoginName())
				.append("deptName", getDeptName())
				.append("ipaddr", getIpaddr())
				.append("loginLocation", getLoginLocation())
				.append("browser", getBrowser())
				.append("os", getOs())
				.append("status", getStatus())
				.append("startTimestamp", getStartTimestamp())
				.append("lastAccessTime", getLastAccessTime())
				.append("expireTime", getExpireTime())
				.toString();
	}
}
